/**
 * Created with IntelliJ IDEA.
 * User: Thoughtworker
 * Date: 7/10/13
 * Time: 3:58 PM
 * To change this template use File | Settings | File Templates.
 */
public class User {

    private String password;
    private String userName;
    private String name;
    private String email;
    private String phone;


    public User(String userName, String password, String name, String email, String phone){
        this.password = password;
        this.userName = userName;
        this.name = name;
        this.email = email;
        this.phone = phone;

    }

    public User(String userName, String password){
        this.password = password;
        this.userName = userName;

    }

    public String getUserName() {
        return userName;
    }

    public String getName() {
        return name;
    }

    public String getEmail() {
        return email;
    }

    public String getPhone() {
        return phone;
    }
    public boolean validatePassword(String passwordToCheck){
        if( passwordToCheck.equals(password) )
            return true;
        return false;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        if (password != null ? !password.equals(user.password) : user.password != null) return false;
        if (userName != null ? !userName.equals(user.userName) : user.userName != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = password != null ? password.hashCode() : 0;
        result = 31 * result + (userName != null ? userName.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (email != null ? email.hashCode() : 0);
        result = 31 * result + (phone != null ? phone.hashCode() : 0);
        return result;
    }

}